//
//  LayoutUtil.m
//  DemoV2
//
//  Created by 董一龙 on 2022/6/25.
//

#import "LayoutUtil.h"

@implementation LayoutUtil
+ (void)setButtonContentCenter:(UIButton*)button{
    CGSize imageViewSize, buttonSize, titleSize;
    UIEdgeInsets imageViewEdge, titleEdge;
    
    imageViewSize = button.imageView.bounds.size;
    titleSize = button.titleLabel.bounds.size;
    buttonSize = button.bounds.size;
    imageViewEdge = UIEdgeInsetsMake(-imageViewSize.height/2, titleSize.width/2, imageViewSize.height/2, -titleSize.width/2);
    [button setImageEdgeInsets:imageViewEdge];
    titleEdge = UIEdgeInsetsMake(titleSize.height/2, -imageViewSize.width/2, -titleSize.height/2, imageViewSize.width/2);
    [button setTitleEdgeInsets:titleEdge];
}
@end
